home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIMIMEInfo.idl < prev    next >
Text File  |  2006-05-08  |  6KB  |  179 lines

  1. /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. /**
  39.  * An nsIMIMEInfo gives a user access to mime information.
  40.  * there is a one-to-many relationship between MIME types
  41.  * and file extensions. This means that a MIMEInfo object
  42.  * may have multiple file extensions associated with it.
  43.  * However, the reverse is not true.
  44.  *
  45.  * MIMEInfo objects are generally retrieved from the MIME Service
  46.  * @see nsIMIMEService
  47.  */
  48.  
  49. #include "nsISupports.idl"
  50.  
  51. interface nsIURI;
  52. interface nsIFile;
  53. interface nsIUTF8StringEnumerator;
  54.  
  55. typedef long nsMIMEInfoHandleAction;
  56.  
  57. [scriptable, uuid(1448b42f-cf0d-466e-9a15-64e876ebe857)]
  58. interface nsIMIMEInfo : nsISupports {
  59.     /**
  60.      * Gives you an array of file types associated with this type.
  61.      *
  62.      * @return Number of elements in the array.
  63.      * @return Array of extensions.
  64.      */
  65.     nsIUTF8StringEnumerator getFileExtensions();
  66.  
  67.     /**
  68.      * Set File Extensions. Input is a comma delimited list of extensions.
  69.      */
  70.     void setFileExtensions(in AUTF8String aExtensions);
  71.  
  72.     /**
  73.      * Returns whether or not the given extension is
  74.      * associated with this MIME info.
  75.      *
  76.      * @return TRUE if the association exists. 
  77.      */
  78.     boolean extensionExists(in AUTF8String aExtension);
  79.  
  80.     /**
  81.      * Append a given extension to the set of extensions
  82.      */
  83.     void appendExtension(in AUTF8String aExtension);
  84.  
  85.     /**
  86.      * Returns the first extension association in
  87.      * the internal set of extensions.
  88.      *
  89.      * @return The first extension.
  90.      */
  91.     attribute AUTF8String primaryExtension;
  92.     
  93.     /**
  94.      * The MIME type of this MIMEInfo.
  95.      * 
  96.      * @return String representing the MIME type.
  97.      */
  98.     readonly attribute ACString MIMEType;
  99.  
  100.     /**
  101.      * A human readable description of the MIME info.
  102.      *
  103.      * @return The description
  104.      */
  105.     attribute AString description;
  106.  
  107.     /**
  108.      * Mac Type and creator types
  109.      */
  110.     attribute PRUint32 macType;
  111.     attribute PRUint32 macCreator;
  112.  
  113.     /**
  114.      * Returns whether or not these two MIME infos are logically
  115.      * equivalent maintaining the one-to-many relationship between
  116.      * MIME types and file extensions.
  117.      *
  118.      * @returns TRUE if the two are considered equal
  119.      */
  120.     boolean equals(in nsIMIMEInfo aMIMEInfo);
  121.  
  122.     /**
  123.      * Returns a nsIFile that points to the application the user has said
  124.      * they want associated with this content type. This is not always
  125.      * guaranteed to be set!!
  126.      */
  127.     attribute nsIFile preferredApplicationHandler;
  128.  
  129.     /**
  130.      * A pretty name description of the preferred application.
  131.      */
  132.     attribute AString applicationDescription;
  133.  
  134.     /**
  135.      * Indicates whether a default application handler exists,
  136.      * i.e. whether launchWithFile with action = useSystemDefault is possible
  137.      * and applicationDescription will contain usable information.
  138.      */
  139.     readonly attribute boolean hasDefaultHandler;
  140.  
  141.     /**
  142.      * A pretty name description of the associated default application. Only
  143.      * usable if hasDefaultHandler is true.
  144.      */
  145.     readonly attribute AString defaultDescription;
  146.  
  147.     /**
  148.      * Launches the application with the specified file, in a way that
  149.      * depends on the value of preferredAction. preferredAction must be
  150.      * useHelperApp or useSystemDefault.
  151.      *
  152.      * @param aFile The file to launch this application with.
  153.      *
  154.      * @throw NS_ERROR_INVALID_ARG if action is not valid for this function.
  155.      * Other exceptions may be thrown.
  156.      */
  157.     void launchWithFile(in nsIFile aFile);
  158.  
  159.     const long saveToDisk = 0;
  160.     const long alwaysAsk = 1;
  161.     const long useHelperApp = 2;
  162.     const long handleInternally = 3;
  163.     const long useSystemDefault = 4;
  164.  
  165.     /**
  166.      * preferredAction is how the user specified they would like to handle
  167.      * this content type: save to disk, use specified helper app, use OS
  168.      * default handler or handle using navigator.
  169.      */
  170.     attribute nsMIMEInfoHandleAction preferredAction;
  171.  
  172.     /**
  173.      * alwaysAskBeforeHandling: if true, we should always give the user a
  174.      * dialog asking how to dispose of this content.
  175.      */
  176.     attribute boolean alwaysAskBeforeHandling;
  177. };
  178.  
  179.